package com.qijian.flowable.domain.query;


import com.baomidou.mybatisplus.annotation.TableName;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.util.Date;
import java.util.List;


/**
 * 流程记录对象 查询条件类
 *
 * @author qijian
 * @date 2021-09-17
 */

@Data
@ToString
@TableName("t_flowable_record")
public class FlowableRecordQuery {

    @WhereType(filed = "process_instance_id")
    private String processInstanceId;
    @WhereType(filed = "process_defintion_id")
    private String processDefintionId;
    @WhereType(filed = "source_id")
    private Long sourceId;
    @WhereType(filed = "business_key", type = WhereTypeEnum.LIKE)
    private String businessKey;
    @WhereType(filed = "business_values")
    private String businessValues;
    @WhereType(filed = "record_name", type = WhereTypeEnum.LIKE)
    private String recordName;

    @WhereType(filed = "record_name", type = WhereTypeEnum.LIKE)
    private String knife;

    @WhereType(filed = "record_type")
    private String recordType;
    @WhereType(filed = "category")
    private String category;
    @WhereType(filed = "user_id")
    private Long userId;
    @WhereType(func = "(t_flowable_record.user_id = {1} or t_flowable_record_power.user_id = {1} OR EXISTS (SELECT 1 FROM t_flowable_record_power t WHERE t.process_intane_id IN ( SELECT m.process_instance_id FROM t_flowable_record m WHERE m.source_id = t_flowable_record.source_id AND m.record_type = t_flowable_record.record_type ) \n" +
            "AND t.user_id = {1}" +
            "))")
    private Long userIdALL;
    @WhereType(filed = "type", tableName = "t_flowable_record_power")
    private String powerType;
    @WhereType(filed = "user_id", tableName = "t_flowable_record_power")
    private Long powerUserId;
    @WhereType(filed = "executor_id")
    private Long executorId;
    @WhereType(filed = "process_content")
    private String processContent;
    @WhereType(filed = "status")
    private String status;
    @WhereType(filed = "create_time", type = WhereTypeEnum.BETWEEN)
    private List<Date> createTime;
    @WhereType(filed = "project_nos", type = WhereTypeEnum.LIKE)
    private String projectNos;
}
